package net.com.sunkey.messagehandler;

import net.com.sunkey.protobuf.Protocol;
import net.com.sunkey.protobuf.ZoneMessageRequest.ZoneMessageRequestData;
import net.com.sunkey.serverlogic.Message;
import net.com.sunkey.serverlogic.User;

/**
 * @author kohachiro
 *
 */
public class ZoneMessageRequestHandler {

	/* (non-Javadoc)
	 * @see com.sunkey.tdserver.messagehandler.MessageHandler#invoke(java.lang.Object, org.jboss.netty.channel.Channel)
	 */
	//@Override
	public static int invoke(Object data, Object channel) throws Exception {
		System.out.println("["+channel.hashCode()+"]["+Protocol.MessageHandler.ZoneMessageRequest_VALUE+"]ZoneMessageRequest");	

		User sender=User.get(channel);
		Message mesage=new Message(((ZoneMessageRequestData)data).getMessage(),sender,Protocol.MessageRouter.ROUTER_ZONE_VALUE);
		sender.sendToZone(mesage);
		return Protocol.MessageHandler.ZoneMessageRequest_VALUE;
	}
}
